import type { PaginationQueryResponseType, PaginationType } from './common'
import type { RoleItemType } from './role'

export type LoginType = 'username' | 'email' | 'phoneNumber'

export type LoginPayloadType =
  | {
      username: string
      password: string
    }
  | {
      email: string
      password: string
    }
  | {
      phoneNumber: string
      password: string
    }

export type LoginResponseType = {
  id: string
  username: string
  email: string
  phoneNumber: string
  token: string
}

export type UserInfoType = {
  id: string
  username: string
  email: string
  phoneNumber: string
}

export type QueryUserPayloadType = {
  username?: string
} & PaginationType

export type QueryUserResponseType = PaginationQueryResponseType<QueryUserItemType>

export type QueryUserItemType = {
  id: string
  username: string
  email: string
  phoneNumber: string
  createdAt: string
  updatedAt: string
  roles: RoleItemType[]
}

export type CreateUserPayloadType = {
  username: string
  password: string
  email: string
  phoneNumber: string
  roleIds: string[]
}

export type updateUserPayloadType = Omit<CreateUserPayloadType, 'password'> & { id: string }
